<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>glLineWidth - OpenGL 4 Reference Pages</title>
    <link rel="stylesheet" type="text/css" href="opengl-man.css"/>
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"/>
    <script type="text/x-mathjax-config">
            MathJax.Hub.Config({
                MathML: {
                    extensions: ["content-mathml.js"]
                },
                tex2jax: {
                    inlineMath: [['$','$'], ['\\(','\\)']]
                }
            });
        </script>
    <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"/>
  </head>
  <body>
    <header/>
    <div class="refentry" id="glLineWidth">
      <div class="titlepage"/>
      <div class="refnamediv">
        <h2>Name</h2>
        <p>glLineWidth — specify the width of rasterized lines</p>
      </div>
      <div class="refsynopsisdiv">
        <h2>C Specification</h2>
        <div class="funcsynopsis">
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glLineWidth</strong>(</code>
              </td>
              <td>GLfloat <var class="pdparam">width</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
        </div>
      </div>
      <div class="refsect1" id="parameters">
        <h2>Parameters</h2>
        <div class="variablelist">
          <dl class="variablelist">
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>width</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>
                    Specifies the width of rasterized lines.
                    The initial value is 1.
                </p>
            </dd>
          </dl>
        </div>
      </div>
      <div class="refsect1" id="description">
        <h2>Description</h2>
        <p>
            <code class="function">glLineWidth</code> specifies the rasterized width of both aliased and antialiased
            lines.
            Using a line width other than 1 has different effects,
            depending on whether line antialiasing is enabled.
            To enable and disable line antialiasing, call
            <a class="citerefentry" href="glEnable.xhtml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a> and  <code class="function">glDisable</code>
            with argument <code class="constant">GL_LINE_SMOOTH</code>. Line antialiasing is initially
            disabled.
        </p>
        <p>
            If line antialiasing is disabled,
            the actual width is determined by rounding the supplied width
            to the nearest integer.
            (If the rounding results in the value 0,
            it is as if the line width were 1.)
            If
            <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
                
                
                <mml:mrow>
                    <mml:mfenced open="∣" close="∣">
                        <mml:mrow>
                            <mml:mo>Δ</mml:mo>
                            <mml:mi mathvariant="italic">x</mml:mi>
                        </mml:mrow>
                    </mml:mfenced>
                    <mml:mo>&gt;=</mml:mo>
                    <mml:mfenced open="∣" close="∣">
                        <mml:mrow>
                            <mml:mo>Δ</mml:mo>
                            <mml:mi mathvariant="italic">y</mml:mi>
                        </mml:mrow>
                    </mml:mfenced>
                </mml:mrow>
            </mml:math>,
            <span class="emphasis"><em>i</em></span> pixels are filled in each column that is rasterized,
            where <span class="emphasis"><em>i</em></span> is the rounded value of <em class="parameter"><code>width</code></em>.
            Otherwise,
            <span class="emphasis"><em>i</em></span> pixels are filled in each row that is rasterized.
        </p>
        <p>
            If antialiasing is enabled,
            line rasterization produces a fragment for each pixel square
            that intersects the region lying within the rectangle having width
            equal to the current line width,
            length equal to the actual length of the line,
            and centered on the mathematical line segment.
            The coverage value for each fragment is the window coordinate area
            of the intersection of the rectangular region with the corresponding
            pixel square.
            This value is saved and used in the final rasterization step.
        </p>
        <p>
            Not all widths can be supported when line antialiasing is enabled. If an
            unsupported width is requested, the nearest supported width is used.
            Only width 1 is guaranteed to be supported; others depend on the
            implementation.  Likewise, there is a range for aliased line widths as well.
            To query the range of supported widths and the size
            difference between supported widths within the range, call <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>
            with arguments <code class="constant">GL_ALIASED_LINE_WIDTH_RANGE</code>,
            <code class="constant">GL_SMOOTH_LINE_WIDTH_RANGE</code>, and <code class="constant">GL_SMOOTH_LINE_WIDTH_GRANULARITY</code>.
        </p>
      </div>
      <div class="refsect1" id="notes">
        <h2>Notes</h2>
        <p>
            The line width specified by <code class="function">glLineWidth</code> is always returned when <code class="constant">GL_LINE_WIDTH</code>
            is queried.
            Clamping and rounding for aliased and antialiased lines have no effect on the specified value.
        </p>
        <p>
            Nonantialiased line width may be clamped to an implementation-dependent maximum.  Call <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with <code class="constant">GL_ALIASED_LINE_WIDTH_RANGE</code> to determine the maximum width.
        </p>
        <p>
            In OpenGL 1.2, the tokens <code class="constant">GL_LINE_WIDTH_RANGE</code> and <code class="constant">GL_LINE_WIDTH_GRANULARITY</code> were replaced by <code class="constant">GL_ALIASED_LINE_WIDTH_RANGE</code>,
            <code class="constant">GL_SMOOTH_LINE_WIDTH_RANGE</code>, and <code class="constant">GL_SMOOTH_LINE_WIDTH_GRANULARITY</code>.  The old names are retained for backward compatibility, but should not be used in new code.
        </p>
      </div>
      <div class="refsect1" id="errors">
        <h2>Errors</h2>
        <p>
            <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>width</code></em> is less than or equal to 0.
        </p>
      </div>
      <div class="refsect1" id="associatedgets">
        <h2>Associated Gets</h2>
        <p>
            <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LINE_WIDTH</code>
        </p>
        <p>
            <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_ALIASED_LINE_WIDTH_RANGE</code>
        </p>
        <p>
            <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_SMOOTH_LINE_WIDTH_RANGE</code>
        </p>
        <p>
            <a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_SMOOTH_LINE_WIDTH_GRANULARITY</code>
        </p>
        <p>
            <a class="citerefentry" href="glIsEnabled.xhtml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_LINE_SMOOTH</code>
        </p>
      </div>
      <div class="refsect1" id="versions">
        <h2>Version Support</h2>
        <div class="informaltable">
          <table style="border-collapse: collapse; border-top: 2px solid ; border-bottom: 2px solid ; border-left: 2px solid ; border-right: 2px solid ; ">
            <colgroup>
              <col style="text-align: left; "/>
              <col style="text-align: center; " class="firstvers"/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; "/>
              <col style="text-align: center; " class="lastvers"/>
            </colgroup>
            <thead>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; ">
                 
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; " colspan="12">
                <span class="bold"><strong>OpenGL Version</strong></span>
            </th>
              </tr>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>Function / Feature Name</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>2.0</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>2.1</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.0</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.1</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.2</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.3</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>4.0</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>4.1</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>4.2</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>4.3</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>4.4</strong></span>
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; ">
                <span class="bold"><strong>4.5</strong></span>
            </th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; ">
                  <code class="function">glLineWidth</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; border-right: 2px solid ; ">✔</td>
                <td style="text-align: center; ">✔</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <div class="refsect1" id="seealso">
        <h2>See Also</h2>
        <p>
            <a class="citerefentry" href="glEnable.xhtml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a>
        </p>
      </div>
      <div class="refsect1" id="Copyright">
        <h2>Copyright</h2>
        <p>
            Copyright <span class="trademark"/>© 1991-2006 Silicon Graphics, Inc.
            Copyright <span class="trademark"/>© 2010-2014 Khronos Group.
            This document is licensed under the SGI Free Software B License.
            For details, see
            <a class="link" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
        </p>
      </div>
    </div>
    <footer/>
  </body>
</html>
